package com.d0324;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TestReg {
    public static void main(String[] args) {
        /*String regex="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        Pattern pattern=Pattern.compile(regex);
        String phoneNum="13958965698";
        Matcher matcher=pattern.matcher(phoneNum);
        if(matcher.matches()) {
            System.out.println("正确");
        }else{
            System.out.println("失败");
        }*/
        String phoneNum="13958965698";
        String regex="^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
        boolean result=phoneNum.matches(regex);
        if(result) {
            System.out.println("正确");
        }else{
            System.out.println("失败");
        }
    }
}
